@import '~@angular/cdk/_overlay.scss';
$combox-prefix:'s-select';
@include cdk-overlay();

/*
*cotagroy:dropdown
*/

$background-color-base: #f7f7f7;
$item-text-color:rgba(0, 0, 0, 0.65);
$item-over-bg:#ecf6fd;
$item-active-bg: #ecf6fd;
%right-icon {
    display: inline-block;
    font-style: normal;
    vertical-align: baseline;
    text-align: center;
    text-transform: none;
    text-rendering: auto;
    opacity: 0;
    position: absolute;
    right: 8px;
    z-index: 1;
    background: #fff;
    top: 50%;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.25);
    width: 12px;
    height: 12px;
    margin-top: -6px;
    line-height: 12px;
    cursor: pointer;
    transition: color 0.3s ease, opacity 0.15s ease;
}

%out-wrap {
    display: inline-block;
    position: relative;
    font-size: 12px;
    width: 120px;
}

:host() {
    @extend %out-wrap;
}

.#{$combox-prefix} {
    @extend %out-wrap;
    &-selection-wrap {
        height: 28px;
        background: #fff;
        border: 1px solid #d9d9d9;
        border-radius: 4px;
        position: relative;
        outline: none;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
        .#{$combox-prefix}-selection-rendered {
            margin: 0 7px;
            position: relative;
            line-height: 26px;
            &::after {
                content: '.';
                display: inline-block;
                visibility: hidden;
                width: 0;
                height: 100%;
            }
            .#{$combox-prefix}-selection-placeholder {
                position: absolute;
                top: 50%;
                margin-top: -10px;
                left: 0px;
                right: 9px;
                line-height: 20px;
                height: 20px;
                max-width: 100%;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                text-align: left;
            }
            .#{$combox-prefix}-selection-selected-value {
                float: left;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                max-width: 100%;
                padding-right: 14px;
            }
            .#{$combox-prefix}-selection-search-inline {
                position: absolute;
                width: 100%;
                height: 100%;
                .#{$combox-prefix}-search-field-wrap {
                    width: 100%;
                    height: 100%;
                    position: relative;
                    display: inline-block;
                    .#{$combox-prefix}-search-field {
                        border-width: 0;
                        font-size: 100%;
                        height: 100%;
                        width: 100%;
                        background: transparent;
                        outline: 0;
                        border-radius: 4px;
                        line-height: 1;
                    }
                    .#{$combox-prefix}-search-field-mirror {}
                }
            }
        }
        .#{$combox-prefix}-selection-clear {
            @extend %right-icon;
        }
        .#{$combox-prefix}-selection-arrow {
            @extend %right-icon;
            opacity: 1;
        }
    }
    &-disabled {
        color: rgba(0, 0, 0, 0.25);
        .#{$combox-prefix}-selection-wrap {
            background: $background-color-base;
            cursor: not-allowed;
        }
        .#{$combox-prefix}-selection-arrow {
            s-icon {
                background: $background-color-base;
                color: #ccc;
            }
        }
    }
}

.#{$combox-prefix}-dropdown {
    top: 0;
    left: 0;
    position: relative;
    width: 100%;
    background-color: #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    box-sizing: border-box;
    z-index: 1050;
    outline: none;
    overflow: hidden;
    font-size: 12px;
    margin-top: 4px;
    margin-bottom: 4px;
    &-menu {
        outline: none;
        margin-bottom: 0;
        padding-left: 0;
        list-style: none;
        max-height: 260px;
        overflow: auto;
        &-item {
            line-height: 1.5;
            position: relative;
            display: block;
            padding: 7px 8px;
            font-weight: normal;
            color: $item-text-color;
            white-space: nowrap;
            cursor: pointer;
            overflow: hidden;
            text-overflow: ellipsis;
            transition: background 0.3s ease;
            &:hover {
                background-color: $item-over-bg;
            }
            &-active {
                background-color: $item-active-bg;
                &:hover {
                    background-color: $item-over-bg;
                }
            }
            &-selected {
                &,
                &:hover {
                    background-color: $background-color-base;
                    font-weight: 600;
                    color: $item-text-color;
                }
            }
            &-disabled {
                color: rgba(0, 0, 0, 0.25);
                cursor: not-allowed;
            }
        }
    }
}